package org.mbds.android.sismapp;

import java.util.ArrayList;

import org.mbds.android.sismapp.db.SensorsDataSQLiteDatabase;

import android.os.Build;

public class SismappStaticCommons {
	public final static int SEISMIC_ALERT_LEVEL_NONE = 0;
	public final static int SEISMIC_ALERT_LEVEL_SENSORS_LOCAL_DETECTION = 1;
	public final static int SEISMIC_ALERT_LEVEL_SENSORS_NETWORK_DETECTION = 2;
	public final static int SEISMIC_ALERT_LEVEL_USER_CONFIRMED = 3;
	
	private static int seismicAlertLevel = SEISMIC_ALERT_LEVEL_NONE;
	private static SensorsDataSQLiteDatabase dbManager = null;
	private static String firstName ="";
	private static String lastName ="";
	private static ArrayList<SismappUser> networkUsers = new ArrayList<SismappUser>();
	
	public static String getDeviceName() {
		  String manufacturer = Build.MANUFACTURER.toUpperCase();
		  String model = Build.MODEL.toUpperCase();
		  if (model.startsWith(manufacturer)) {
		    return model;
		  } else {
		    return manufacturer + " " + model;
		  }
		}
	public static void setDatabaseManager(SensorsDataSQLiteDatabase db) {
		dbManager=db;
	}
	public static SensorsDataSQLiteDatabase getDatabaseManager() {
		return dbManager;
	}
	public static String getLastName() {
		return lastName;
	}
	public static void setLastName(String lastName) {
		SismappStaticCommons.lastName = lastName;
	}
	public static String getFirstName() {
		return firstName;
	}
	public static void setFirstName(String firstName) {
		SismappStaticCommons.firstName = firstName;
	}
	public static int getSeismicAlertLevel() {
		return seismicAlertLevel;
	}
	public static void setSeismicAlertLevel(int alertLevel) {
		seismicAlertLevel = alertLevel;
	}
	public static void updateNetworkUsers(SismappUser user) {
		networkUsers.remove(user);
		networkUsers.add(user);
	}
	public static ArrayList<SismappUser> getNetworkUsers() {
		return networkUsers;
	}
}
